/**
 * @fileoverview Script to update the eslint:all configuration.
 * @author Nicholas C. Zakas
 */

"use strict";

//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------

const fs = require("fs");
const builtInRules = require("../lib/rules");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

const allRules = {};

for (const [ruleId, rule] of builtInRules) {
    if (!rule.meta.deprecated) {
        allRules[ruleId] = "error";
    }
}

//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------

const code = `/*
 * WARNING: This file is autogenerated using the tools/update-eslint-all.js
 * script. Do not edit manually.
 */
"use strict";

/* eslint quote-props: off -- autogenerated so don't lint */

module.exports = Object.freeze(${JSON.stringify({ rules: allRules }, null, 4)});
`;

fs.writeFileSync("./packages/js/src/configs/eslint-all.js", code, "utf8");
